<?php
$isReloadable = false;
require_once "../../../pers/inc.config.php";
require_once OVF_FS_WEB_ROOT.'/app/_inc/inc.session.php';
require_once OVF_FS_WEB_ROOT.'/app/_inc/funct.html.php';
require_once '../_inc/class.wfmModulo.php';
require_once '../_inc/class.wfmPagina.php';

$oMod = new wfmModulo(reqVarInt('id'));
if ($oMod->codModulo == "") {
	backOnErr("id_modulo '".reqVar('id')."' errato");
	exit;
}
$oPag = new wfmPagina($oMod, reqVarInt('id'), 'ini');
if ($oPag->codPagina == "") {
	backOnErr("id_modulo '".reqVar('id')."' pagina ini errata");
	exit;
}

$oPag->prepIns();

if (reqVar('azione') == 'submCmd') {
	$msgPag = $oPag->eseguiIns();
} 


$sCmdR = $oPag->getHtmlComandi();
$sCmdR .= cmdTorna();

testaHtml($oPag->oMod->titolo,'Nuova registrazione',$msgPag,'wfma');
?>
<script type="text/javascript">
<!--
function submCmd(id,cmd) {
	document.frm1.X_id_comando.value = id;
	document.frm1.X_comando.value = cmd;
	document.frm1.azione.value = 'submCmd';
	document.frm1.submit();
}
//-->
</script>
<table border="0" cellpadding="3" cellspacing="1" width="100%" align='center'>
   <tr>
      <td class="cmd1" align="right">
			<? echo  $sCmdR;?>
      </td>
   </tr>
</table>
<?=getHtmlForm('frm1','',array('enctype'=>true));?>
<?=getHtmlHidden('azione','...');?>
<?=getHtmlHidden('id');?>
<?=getHtmlHidden('X_id_modulo',$oPag->idModulo);?>
<?=getHtmlHidden('X_id_pagina',$oPag->idPagina);?>
<?=getHtmlHidden('X_id_comando',0);?>
<?=getHtmlHidden('X_comando','');?>
<?=getHtmlHidden('xsn',XSN);?>
<div style="margin:0;padding:0;color:red;">
<?
$sHtml = $oPag->getHtmlPagina('mod');
if (substr($sHtml,0,10)=='@@include=') {
	include substr($sHtml,10);
} else {
	echo $sHtml;
}

?>
</div>
<table border="0" cellpadding="3" cellspacing="1" width="100%" align='center'>
   <tr>
      <td class="cmd1" align="right">
         <? echo  $sCmdR;?>
      </td>
   </tr>
</table>
<?
echo "</form>\n";
codaHtml();
exit();
